#！/bin/bash
rm -r ~/res.txt
touch ~/res.txt

for (( i=0; i < 10; i++ ))
do
	cp -f ~/yaml_gen/$i.yaml ~/catkin_ws/src/rbx1/rbx1_nav/config/fake/global_planner_params.yaml
	echo $i.yaml
	rm -r ~/out.txt
	touch ~/out.txt

	

	gnome-terminal  -x bash -c "roslaunch rbx1_bringup fake_turtlebot.launch"

	sleep 5s


	gnome-terminal -x bash -c "roslaunch rbx1_nav fake_amcl.launch map:=test_map.yaml"

	sleep 5s


	#gnome-terminal -x bash -c "rosrun rviz rviz -d `rospack find rbx1_nav`/nav.rviz"


	psid=`pgrep launch`
	#echo ${psid[0]}
	#gnome-terminal -x bash -c "rosrun rbx1_nav nav_test.py"
	a=`rosrun rbx1_nav nav_test.py`
	echo $a

	#wid=`xdotool search "fake_amcl" | head -1`

	#wmctrl -ic $wid
	#sleep 1s

	#wid2=`xdotool search "fake_turtlebot" | head -1`
	#wmctrl -ic $wid2

	kill $psid
done



